package serializable;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import serializable.jaxb.Context;
import serializable.testdata.DataObject;

public class Actions {

	public static void main(String[] args) throws Throwable {
		DataObject obj = new DataObject();
		obj.setMyData("1111111111111111111" + "11111111111112222222222222"
				+ "333333333333333");
		File file = new File("stotr.bin");

		FileOutputStream fo = new FileOutputStream(file);
		ObjectOutputStream so = new ObjectOutputStream(fo);
		so.writeObject(obj);
		so.flush();
		so.close();

		FileInputStream fi = new FileInputStream(file);
		ObjectInputStream si = new ObjectInputStream(fi);
		DataObject objNem = (DataObject) si.readObject();
		si.close();
		
		System.out.println(objNem.getMyData());
		
		File file2 = new File("stotr2.bin");
		Context context=new Context(obj, file2);
		System.out.println(context.obj.getMyData());

	}
}
